package com.bo.mapper;

import com.bo.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

/**
 * @author huangbo
 * @version 1.0.0
 */
@Mapper
public interface DeptMapper {
    @Select("select * from tlias2.dept")
    public List<Dept> list() ;

    @Delete("delete from tlias2.dept where id=#{id}")
    void deleteById(Integer id);

    @Delete("insert into tlias2.dept(name, create_time, update_time) values (#{name}, #{createTime}, #{createTime})")   //数据库中属性为下划线命名，Dept类实例中为驼峰命名，如果没有提前配置驼峰映射则会出错
    void add(Dept dept);

    @Select("select * from tlias2.dept where id = #{id}")
    Dept find(Integer id);

    @Update("update tlias2.dept set name=#{name}, update_time = #{updateTime} where id = #{id}")
    void change(Dept newDept);
}